// 首页顶部组件
Vue.component('index-header', {
    // props: ['top'],
    data() {
        return {
            searchChoseData: {
                id: [0,1,2,3],
                text: ['货单', '客户', '工厂', '工人']
            },
            navData: {
                id: [0,1,2,3,4,5],
                name: ['indexInfo','manifest','custom','factory','staff','download'],
                text: ['首页', '货单', '客户', '工厂', '工人', '下载']
            }
        }
    },
    template: `<div class="index__box">
                    <div class="index__box__top">
                        <div class="index__top__con">
                            <div class="index__top__left">
                                <span>杭州 切换城市</span>
                            </div>
                            <div class="index__top__right">
                                <span>消息提醒</span>
                                <span>微信公众号</span>
                            </div>
                        </div>
                    </div>
                    <div class="index__box__header">
                        <div class="index__header__con">
                            <div class="index__header__logo"></div>
                            <div class="index__header__search">
                                <div class="index__search__chose">
                                    <select>
                                        <option value="" v-for="item in searchChoseData.text">{{item}}</option>
                                    </select>
                                </div>
                                <div class="index__search__input">
                                    <span></span>
                                    <input type="text">
                                    <b>搜索</b>
                                </div>
                            </div>
                            <div class="index__header__login" @click="goLinkFun">
                                <span data-type="1">登录</span>
                                <span data-type="2">注册</span>
                                <span data-type="3">你好，用户名称！</span>
                            </div>
                        </div>
                    </div>
                    <div class="index__box__nav">
                        <div class="index__nav__con">
                            <ul>
                                <router-link v-for="(item, index) in navData.name" :to="{name: item}" tag="li"><a href="javascript:;">{{navData.text[index]}}</a></router-link>
                            </ul>
                        </div>
                    </div>
                </div>`,
    methods: {
        goLinkFun: function (e) { // 跳转
            let type = parseInt(e.target.dataset.type)
            switch (type) {
                case 1:
                    window.location.href = '/pc/public/login'
                break
                case 2:
                    window.location.href = '/pc/public/login'
                break
                case 3:
                    window.location.href = '/pc/public/company'
                break
                case 4:
                break
            }

        }
    },
    mounted() {
        
    },
    created() {
        
    },
})
